#include<bits/stdc++.h>
using namespace std;
const int con=100030;
int n,a[con];
//b[con];
//bool v[con];
int main(){
	ios::sync_with_stdio(false);
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;++i)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	int i=1,l=2;
	while(a[i+1]==a[i])i++;
	//v[i]=1;
	//tot++;
	//b[tot]=a[i];
	i+=2;
	//cout<<l<<i<<"\n";
	while(i<=n)
	{
		while(a[i]==a[l])i++;
		//v[i]=1;
		l++;
		i++;
	}
	if(i==n+2) l--;
	//cout<<l<<i<<"\n";
	cout<<n-l+1<<"\n";
	return 0;
}
